/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package conexaobancodedados;

/**
 *
 * @author fosa
 */
import java.io.IOException;
import java.sql.*;
import java.util.logging.Level;
import java.util.logging.Logger;

public class Conect {

    private static String Gluser;
    private static String Glpassword;
    private static String Gllocal;
    private static Statement Glconexão;

    public static void connect() {

        try {
            Class.forName("com.mysql.jdbc.Driver").newInstance();
            Connection con = DriverManager.getConnection("jdbc:mysql://" + getGllocal() + ":3306/", getGluser(), getGlpassword());
            setGlconexão(con.createStatement());

//            Fronteira.stm = (com.mysql.jdbc.Statement) Glconexão;
        } catch (InstantiationException ex) {
//            Fronteira.janelaconexao.show();
            System.out.println("Houve erro no iniciando a conexão");
        } catch (IllegalAccessException ex) {
//            Fronteira.janelaconexao.show();
            System.out.println("Houve erro no acessando a conexão");
        } catch (ClassNotFoundException ex) {
//            Fronteira.janelaconexao.show();
            System.out.println("Houve erro no nao encontrou a conexão");
        } catch (SQLException e) {
//            Fronteira.janelaconexao.show();
            System.out.println("Houve erro SQLException sem conexao ao banco de dados");
        }
    }

    /**
     * @return the Gluser
     */
    public static String getGluser() {
        return Gluser;
    }

    /**
     * @param Gluser the Gluser to set
     */
    public static void setGluser(String Gluser) {
        Conect.Gluser = Gluser;
    }

    /**
     * @return the Glpassword
     */
    public static String getGlpassword() {
        return Glpassword;
    }

    /**
     * @param Glpassword the Glpassword to set
     */
    public static void setGlpassword(String Glpassword) {
        Conect.Glpassword = Glpassword;
    }

    /**
     * @return the Gllocal
     */
    public static String getGllocal() {
        return Gllocal;
    }

    /**
     * @param Gllocal the Gllocal to set
     */
    public static void setGllocal(String Gllocal) {
        Conect.Gllocal = Gllocal;
    }

    /**
     * @return the Glconexão
     */
    public static Statement getGlconexão() {
        return Glconexão;
    }

    /**
     * @param Glconexão the Glconexão to set
     */
    public static void setGlconexão(Statement Glconexão) {
        Conect.Glconexão = Glconexão;
    }
}
